package com.egao.orderB.controller;

import com.egao.common.core.annotation.ApiPageParam;
import com.egao.common.core.annotation.OperLog;
import com.egao.common.core.damon.results.PageResult2;
import com.egao.common.core.web.BaseController;
import com.egao.common.core.web.JsonResult;
import com.egao.orderB.entity.OtherFee;
import com.egao.orderB.service.OtherFeeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 *
 * 其他表的费用
 * @author : Doman
 * @date : 2021-11-17 15:26:59
 * @version ：1.0
 */

@Api(tags = "其他表的费用")
@RestController
@RequestMapping("/api/orderB/otherFee")
public class OtherFeeController extends BaseController {

	@Autowired
	private OtherFeeService otherFeeService;

	/**
	 * 分页查询列表
	 */
//	@PreAuthorize("hasAuthority('orderB:otherFee:list')")
  @ApiOperation(value ="分页查询其他表的费用",notes = "" +
    "limit:每页显示几行 必填\n" +
    "page:第几页 必填\n" +
    "tableName:表名\n" +
    "tableId:主表id\n" +
    " \n\n\n" +
    "返回的结果:\n" +
    "id:id\n" +
    "tableName:表名 值:\n" +
    "客户计划:chf_ocean_customer_plan\n" +
    "预存仓位chf_ocean_pre_storage_position\n" +
    "tableId:订单id\n" +
    "type:类型\n" +
    "feeName:费用名称\n" +
    "price:金额\n" +
    "standard:标准\n" +
    "feeState:费用状态:未确认,已确认\n" +
    "feePerson:确认人\n" +
    "feeTime:确认时间\n" +
    "fobject:费用对象 货代,司机,码头\n" +
    "feeModules:模块 运费,提进,其他,单项,采购,报关费,易港通,财务报销\n" +
    "invoiceid:抬头id\n" +
    "invoicename:抬头\n" +
    "driverName:司机名称\n" +
    "invoicenum:税点(这个字段没有用了以后删掉)\n" +
    "invoicestate:是否开票:开票1 不开票0  \n" +
    "currency:币种\n" +
    "exchangeRate:汇率\n" +
    "settlement:销账 0未销账 1部分 2全部\n" +
    "settlementPrice:销账金额\n" +
    "remark:备注\n" +
    "state:false\n" +
    "createTime:创建时间\n" +
    "createUser:创建人\n" +
    "updateTime:更新时间\n" +
    "updateUser:更新人\n" +
    "",httpMethod = "POST")
  @ApiPageParam
  @PostMapping("/list")
  public JsonResult page(PageResult2<T> page, OtherFee otherFee) throws Exception{
    return otherFeeService.list(page, otherFee, getLoginUser());
  }

  /**
   * 查询全部其他表的费用
   */
//  @PreAuthorize("hasAuthority('orderB:otherFee:list')")
  @ApiOperation("查询全部其他表的费用")
  @PostMapping("/listAll")
  public JsonResult list(OtherFee otherFee){
    return otherFeeService.list(otherFee, getLoginUser());
  }

  /**
   * 根据id查询其他表的费用
   */
//  @PreAuthorize("hasAuthority('orderB:otherFee:list')")
  @ApiOperation("根据id查询其他表的费用")
  @PostMapping("/get")
  public JsonResult get(OtherFee otherFee) {
    return otherFeeService.getById(otherFee);
  }


  /**
   * 添加其他表的费用
   */
//  @PreAuthorize("hasAuthority('orderB:otherFee:save')")
  @OperLog(value = "其他表的费用", desc = "添加", param = false, result = true)
  @ApiOperation(value ="添加其他表的费用",notes = "" +
    "tableName:表名 值:\n" +
    "客户计划:chf_ocean_customer_plan\n" +
    "预存仓位chf_ocean_pre_storage_position\n" +
    "tableId:订单id\n" +
    "type:类型\n" +
    "feeName:费用名称\n" +
    "price:金额\n" +
    "standard:标准\n" +
    "feeState:费用状态:未确认,已确认\n" +
    "feePerson:确认人\n" +
    "feeTime:确认时间\n" +
    "fobject:费用对象 货代,司机,码头\n" +
    "feeModules:模块 运费,提进,其他,单项,采购,报关费,易港通,财务报销\n" +
    "invoiceid:抬头id\n" +
    "invoicename:抬头\n" +
    "driverName:司机名称\n" +
    "invoicenum:税点(这个字段没有用了以后删掉)\n" +
    "invoicestate:是否开票:开票1 不开票0  \n" +
    "currency:币种\n" +
    "exchangeRate:汇率\n" +
    "settlement:销账 0未销账 1部分 2全部\n" +
    "settlementPrice:销账金额\n" +
    "remark:备注\n" +
    "",httpMethod = "POST")
  @PostMapping("/save")
  public JsonResult save(Model model, OtherFee otherFee) {
    return otherFeeService.save(otherFee, getLoginUser());
  }

  /**
   * 修改其他表的费用
   */
//  @PreAuthorize("hasAuthority('orderB:otherFee:update')")
  @OperLog(value = "其他表的费用", desc = "修改", param = false, result = true)
  @ApiOperation(value ="修改其他表的费用",notes = "" +
    "id:id\n" +
    "feeName:费用名称\n" +
    "price:金额\n" +
    "standard:标准\n" +
    "feeState:费用状态:未确认,已确认\n" +
    "feePerson:确认人\n" +
    "feeTime:确认时间\n" +
    "fobject:费用对象 货代,司机,码头\n" +
    "feeModules:模块 运费,提进,其他,单项,采购,报关费,易港通,财务报销\n" +
    "invoiceid:抬头id\n" +
    "invoicename:抬头\n" +
    "driverName:司机名称\n" +
    "invoicenum:税点(这个字段没有用了以后删掉)\n" +
    "invoicestate:是否开票:开票1 不开票0  \n" +
    "currency:币种\n" +
    "exchangeRate:汇率\n" +
    "settlement:销账 0未销账 1部分 2全部\n" +
    "settlementPrice:销账金额\n" +
    "remark:备注\n" +
    "",httpMethod = "POST")
  @PostMapping("/update")
  public JsonResult update(Model model, OtherFee otherFee) {
    return otherFeeService.update(otherFee, getLoginUser());
  }

  /**
   * 删除其他表的费用
   */
//  @PreAuthorize("hasAuthority('orderB:otherFee:remove')")
  @OperLog(value = "其他表的费用", desc = "删除", result = true)
  @ApiOperation(value ="删除其他表的费用",notes = "" +
    "id:id\n" +
    "",httpMethod = "POST")
  @PostMapping("/remove")
  public JsonResult remove(OtherFee otherFee ) {
    return otherFeeService.remove(otherFee, getLoginUser());
  }

}
